#include <stdio.h>
#include <string.h>

struct Date{
	int year;
	int month;
	int day;
};

struct Book{
	char title[128];
	char author[40];
	float price;
	struct Date date;
	char publisher[40];
};

void getInput(struct Book *);
void printBook(struct Book *);

void getInput(struct Book * book){
	printf("请输入书名:\n");
	gets(book->title);

	printf("请输入作者:\n");
	gets(book->author);

	printf("请输入出版社:\n");
	gets(book->publisher);

	printf("请输入售价:\n");
	scanf("%f", &book->price);

	printf("请输入出版时间:\n");
	scanf("%d-%d-%d", &book->date.year, &book->date.month, &book->date.day);
	getchar();
}

void printBook(struct Book * book){
	printf("书名:%s \n", book->title);
	printf("作者:%s \n", book->author);
	printf("售价:%.2f \n", book->price);
	printf("出版时间:%d-%d-%d \n", book->date.year, book->date.month, book->date.day);
	printf("出版社:%s \n", book->publisher);
}

int main(void){
	struct Book *book1, *book2;
	struct Book b1, b2;
	book1 = &b1;
	book2 = &b2;

	printf("pls input the info of first book\n");
	getInput(book1);
	putchar('\n');

	printf("pls input the info of second book\n");
	getInput(book2);
	putchar('\n');

	printf("信息录入完毕\n");

	printf("第一本书信息如下:\n");
	printBook(book1);

	printf("第二本书信息如下:\n");
	printBook(book2);

	return 0;
}